// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_HomeAutomationGateway1.xml
    
    public class HomeAutomationGateway1Service : MiosService
    {
        #region UserData : String;
        private String _mUserData;
        
        public String UserData
        {
            get
            {
                return _mUserData ?? GetUserData();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetUserData() : String;
        public String GetUserData()
        {
            _mUserData = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "UserData"));
            
            return _mUserData;
        }
        #endregion Action GetUserData
        
        #endregion
        
        #region DataFormat : String;
        private String _mDataFormat;
        
        public String DataFormat
        {
            get
            {
                return _mDataFormat ?? GetDataFormat();
            }
        }
        
        #region Action SetDataFormat(String newDataFormat) : String;
        public String SetDataFormat(String newDataFormat)
        {
            if (String.IsNullOrEmpty(newDataFormat))
                throw new ArgumentNullException("newDataFormat");
            
            switch(newDataFormat)
            {
                case "json":
                case "xml":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newDataFormat");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetDataFormat",
                String.Format("newDataFormat={0}", ToLuup(_mDataFormat = newDataFormat)));
        }
        #endregion Action SetDataFormat
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDataFormat() : String;
        public String GetDataFormat()
        {
            _mDataFormat = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DataFormat"));
            
            return _mDataFormat;
        }
        #endregion Action GetDataFormat
        
        #endregion
        
        #region DeviceNum : UInt32;
        private UInt32? _mDeviceNum;
        
        public UInt32 DeviceNum
        {
            get
            {
                return _mDeviceNum ?? GetDeviceNum();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDeviceNum() : UInt32;
        public UInt32 GetDeviceNum()
        {
            _mDeviceNum = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DeviceNum"));
            
            return _mDeviceNum.Value;
        }
        #endregion Action GetDeviceNum
        
        #endregion
        
        #region DataVersion : UInt32;
        private UInt32? _mDataVersion;
        
        public UInt32 DataVersion
        {
            get
            {
                return _mDataVersion ?? GetDataVersion();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDataVersion() : UInt32;
        public UInt32 GetDataVersion()
        {
            _mDataVersion = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DataVersion"));
            
            return _mDataVersion.Value;
        }
        #endregion Action GetDataVersion
        
        #endregion
        
        #region UDN : String;
        private String _mUDN;
        
        public String UDN
        {
            get
            {
                return _mUDN ?? GetUDN();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetUDN() : String;
        public String GetUDN()
        {
            _mUDN = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "UDN"));
            
            return _mUDN;
        }
        #endregion Action GetUDN
        
        #endregion
        
        #region ActiveScenes : String;
        private String _mActiveScenes;
        
        public String ActiveScenes
        {
            get
            {
                return _mActiveScenes ?? GetActiveScenes();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetActiveScenes() : String;
        public String GetActiveScenes()
        {
            _mActiveScenes = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ActiveScenes"));
            
            return _mActiveScenes;
        }
        #endregion Action GetActiveScenes
        
        #endregion
        
        #region DataVersionUserData : UInt32;
        private UInt32? _mDataVersionUserData;
        
        public UInt32 DataVersionUserData
        {
            get
            {
                return _mDataVersionUserData ?? GetDataVersionUserData();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDataVersionUserData() : UInt32;
        public UInt32 GetDataVersionUserData()
        {
            _mDataVersionUserData = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DataVersionUserData"));
            
            return _mDataVersionUserData.Value;
        }
        #endregion Action GetDataVersionUserData
        
        #endregion
        
        #region DataVersionStatus : UInt32;
        private UInt32? _mDataVersionStatus;
        
        public UInt32 DataVersionStatus
        {
            get
            {
                return _mDataVersionStatus ?? GetDataVersionStatus();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDataVersionStatus() : UInt32;
        public UInt32 GetDataVersionStatus()
        {
            _mDataVersionStatus = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DataVersionStatus"));
            
            return _mDataVersionStatus.Value;
        }
        #endregion Action GetDataVersionStatus
        
        #endregion
        
        #region Reload : Boolean;
        private Boolean? _mReload;
        
        public Boolean Reload
        {
            get
            {
                return _mReload ?? GetReload();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetReload() : Boolean;
        public Boolean GetReload()
        {
            _mReload = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Reload"));
            
            return _mReload.Value;
        }
        #endregion Action GetReload
        
        #endregion
        
        
        #region Action /* WARNING: [Action ActionName collides with ActionName of a State Variable!] */ Action_Reload()
        public void /* WARNING: [Action ActionName collides with ActionName of a State Variable!] */ Action_Reload()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "Reload");
        }
        #endregion Action /* WARNING: [Action ActionName collides with ActionName of a State Variable!] */ Action_Reload
        
        #region Action GetUserData(String userData, String dataFormat, UInt32 dataVersion) : String;
        public String GetUserData(String userData, String dataFormat, UInt32 dataVersion)
        {
            if (String.IsNullOrEmpty(dataFormat))
                throw new ArgumentNullException("dataFormat");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupString(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "GetUserData"
                , String.Format("DataFormat={0}", ToLuup(dataFormat))
                , String.Format("DataVersion={0}", ToLuup(dataVersion))
                )); // Engine.Luup_CallAction
        }
        #endregion Action GetUserData
        
        #region Action ModifyUserData(String inUserData, String userData, String dataFormat, Boolean reload) : String;
        public String ModifyUserData(String inUserData, String userData, String dataFormat, Boolean reload)
        {
            if (String.IsNullOrEmpty(inUserData))
                throw new ArgumentNullException("inUserData");
            
            if (String.IsNullOrEmpty(dataFormat))
                throw new ArgumentNullException("dataFormat");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupString(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "ModifyUserData"
                , String.Format("inUserData={0}", ToLuup(inUserData))
                , String.Format("DataFormat={0}", ToLuup(dataFormat))
                , String.Format("Reload={0}", ToLuup(reload))
                )); // Engine.Luup_CallAction
        }
        #endregion Action ModifyUserData
        
        #region Action SetVariable(UInt32 deviceNum, String uDN, String service, String variable, String value) : String;
        public String SetVariable(UInt32 deviceNum, String uDN, String service, String variable, String value)
        {
            if (String.IsNullOrEmpty(service))
                throw new ArgumentNullException("service");
            
            if (String.IsNullOrEmpty(variable))
                throw new ArgumentNullException("variable");
            
            if (String.IsNullOrEmpty(value))
                throw new ArgumentNullException("value");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupString(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetVariable"
                , String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , String.Format("Service={0}", ToLuup(service))
                , String.Format("Variable={0}", ToLuup(variable))
                , String.Format("Value={0}", ToLuup(value))
                )); // Engine.Luup_CallAction
        }
        #endregion Action SetVariable
        
        #region Action GetVariable(UInt32 deviceNum, out String uDN, String service, String variable, out String value)
        public void GetVariable(UInt32 deviceNum, out String uDN, String service, String variable, out String value)
        {
            if (String.IsNullOrEmpty(service))
                throw new ArgumentNullException("service");
            
            if (String.IsNullOrEmpty(variable))
                throw new ArgumentNullException("variable");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            uDN = default(String);
            value = default(String);
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "GetVariable"
                , String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , String.Format("UDN={0}", ToLuup(uDN))
                , String.Format("Service={0}", ToLuup(service))
                , String.Format("Variable={0}", ToLuup(variable))
                , String.Format("Value={0}", ToLuup(value))
                ); // Engine.Luup_CallAction
        }
        #endregion Action GetVariable
        
        #region Action GetStatus(String status, String dataFormat, UInt32? deviceNum, String uDN) : String;
        public String GetStatus(String status, String dataFormat, UInt32? deviceNum, String uDN)
        {
            if (String.IsNullOrEmpty(dataFormat))
                throw new ArgumentNullException("dataFormat");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupString(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "GetStatus"
                , String.Format("DataFormat={0}", ToLuup(dataFormat))
                , deviceNum == null ? "" : String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , uDN == null ? "" : String.Format("UDN={0}", ToLuup(uDN))
                )); // Engine.Luup_CallAction
        }
        #endregion Action GetStatus
        
        #region Action GetActions(UInt32 deviceNum, String uDN, String dataFormat, String actions) : String;
        public String GetActions(UInt32 deviceNum, String uDN, String dataFormat, String actions)
        {
            if (String.IsNullOrEmpty(uDN))
                throw new ArgumentNullException("uDN");
            
            if (String.IsNullOrEmpty(dataFormat))
                throw new ArgumentNullException("dataFormat");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupString(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "GetActions"
                , String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , String.Format("UDN={0}", ToLuup(uDN))
                , String.Format("DataFormat={0}", ToLuup(dataFormat))
                )); // Engine.Luup_CallAction
        }
        #endregion Action GetActions
        
        #region Action RunScene(UInt32 sceneNum)
        public void RunScene(UInt32 sceneNum)
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RunScene"
                , String.Format("SceneNum={0}", ToLuup(sceneNum))
                ); // Engine.Luup_CallAction
        }
        #endregion Action RunScene
        
        #region Action SceneOff(UInt32 sceneNum)
        public void SceneOff(UInt32 sceneNum)
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SceneOff"
                , String.Format("SceneNum={0}", ToLuup(sceneNum))
                ); // Engine.Luup_CallAction
        }
        #endregion Action SceneOff
        
        #region Action RunLua(UInt32? deviceNum, String code)
        public void RunLua(UInt32? deviceNum, String code)
        {
            if (String.IsNullOrEmpty(code))
                throw new ArgumentNullException("code");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RunLua"
                , deviceNum == null ? "" : String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , String.Format("Code={0}", ToLuup(code))
                ); // Engine.Luup_CallAction
        }
        #endregion Action RunLua
        
        #region Action ProcessChildDevices(UInt32 deviceNumParent, String deviceList)
        public void ProcessChildDevices(UInt32 deviceNumParent, String deviceList)
        {
            if (String.IsNullOrEmpty(deviceList))
                throw new ArgumentNullException("deviceList");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "ProcessChildDevices"
                , String.Format("DeviceNumParent={0}", ToLuup(deviceNumParent))
                , String.Format("DeviceList={0}", ToLuup(deviceList))
                ); // Engine.Luup_CallAction
        }
        #endregion Action ProcessChildDevices
        
        #region Action CreateDevice(UInt32 deviceNum, String deviceType, String internalID, String description, String upnpDevFilename, String upnpImplFilename, String ipAddress, String macAddress, UInt32 deviceNumParent, UInt32 roomNum, String stateVariables) : UInt32;
        public UInt32 CreateDevice(UInt32 deviceNum, String deviceType, String internalID, String description, String upnpDevFilename, String upnpImplFilename, String ipAddress, String macAddress, UInt32 deviceNumParent, UInt32 roomNum, String stateVariables)
        {
            if (String.IsNullOrEmpty(deviceType))
                throw new ArgumentNullException("deviceType");
            
            if (String.IsNullOrEmpty(internalID))
                throw new ArgumentNullException("internalID");
            
            if (String.IsNullOrEmpty(description))
                throw new ArgumentNullException("description");
            
            if (String.IsNullOrEmpty(upnpDevFilename))
                throw new ArgumentNullException("upnpDevFilename");
            
            if (String.IsNullOrEmpty(upnpImplFilename))
                throw new ArgumentNullException("upnpImplFilename");
            
            if (String.IsNullOrEmpty(ipAddress))
                throw new ArgumentNullException("ipAddress");
            
            if (String.IsNullOrEmpty(macAddress))
                throw new ArgumentNullException("macAddress");
            
            if (String.IsNullOrEmpty(stateVariables))
                throw new ArgumentNullException("stateVariables");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupUInt32(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "CreateDevice"
                , String.Format("deviceType={0}", ToLuup(deviceType))
                , String.Format("internalID={0}", ToLuup(internalID))
                , String.Format("Description={0}", ToLuup(description))
                , String.Format("UpnpDevFilename={0}", ToLuup(upnpDevFilename))
                , String.Format("UpnpImplFilename={0}", ToLuup(upnpImplFilename))
                , String.Format("IpAddress={0}", ToLuup(ipAddress))
                , String.Format("MacAddress={0}", ToLuup(macAddress))
                , String.Format("DeviceNumParent={0}", ToLuup(deviceNumParent))
                , String.Format("RoomNum={0}", ToLuup(roomNum))
                , String.Format("StateVariables={0}", ToLuup(stateVariables))
                )); // Engine.Luup_CallAction
        }
        #endregion Action CreateDevice
        
        #region Action DeleteDevice(UInt32 deviceNum, String uDN)
        public void DeleteDevice(UInt32 deviceNum, String uDN)
        {
            if (String.IsNullOrEmpty(uDN))
                throw new ArgumentNullException("uDN");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "DeleteDevice"
                , String.Format("DeviceNum={0}", ToLuup(deviceNum))
                , String.Format("UDN={0}", ToLuup(uDN))
                ); // Engine.Luup_CallAction
        }
        #endregion Action DeleteDevice
        
        #region Action CreatePlugin(UInt32 pluginNum, String stateVariables)
        public void CreatePlugin(UInt32 pluginNum, String stateVariables)
        {
            if (String.IsNullOrEmpty(stateVariables))
                throw new ArgumentNullException("stateVariables");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "CreatePlugin"
                , String.Format("PluginNum={0}", ToLuup(pluginNum))
                , String.Format("StateVariables={0}", ToLuup(stateVariables))
                ); // Engine.Luup_CallAction
        }
        #endregion Action CreatePlugin
        
        #region Action DeletePlugin(UInt32 pluginNum)
        public void DeletePlugin(UInt32 pluginNum)
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "DeletePlugin"
                , String.Format("PluginNum={0}", ToLuup(pluginNum))
                ); // Engine.Luup_CallAction
        }
        #endregion Action DeletePlugin
        
        #region Action CreatePluginDevice(UInt32 pluginNum, String stateVariables)
        public void CreatePluginDevice(UInt32 pluginNum, String stateVariables)
        {
            if (String.IsNullOrEmpty(stateVariables))
                throw new ArgumentNullException("stateVariables");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "CreatePluginDevice"
                , String.Format("PluginNum={0}", ToLuup(pluginNum))
                , String.Format("StateVariables={0}", ToLuup(stateVariables))
                ); // Engine.Luup_CallAction
        }
        #endregion Action CreatePluginDevice
        
        #region Action ImportUpnpDevice(UInt32 deviceNum, String uDN, UInt32 roomNum) : UInt32;
        public UInt32 ImportUpnpDevice(UInt32 deviceNum, String uDN, UInt32 roomNum)
        {
            if (String.IsNullOrEmpty(uDN))
                throw new ArgumentNullException("uDN");
            
            // WARNING: This version of code generator does not know how to generate Http Luup requests with out variables.
            // Below generated code may not function properly!
            // 
            
            return FromLuupUInt32(
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "ImportUpnpDevice"
                , String.Format("UDN={0}", ToLuup(uDN))
                , String.Format("RoomNum={0}", ToLuup(roomNum))
                )); // Engine.Luup_CallAction
        }
        #endregion Action ImportUpnpDevice
        
        #region Action LogIpRequest(String ipAddress, String macAddress)
        public void LogIpRequest(String ipAddress, String macAddress)
        {
            if (String.IsNullOrEmpty(ipAddress))
                throw new ArgumentNullException("ipAddress");
            
            if (String.IsNullOrEmpty(macAddress))
                throw new ArgumentNullException("macAddress");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "LogIpRequest"
                , String.Format("IpAddress={0}", ToLuup(ipAddress))
                , String.Format("MacAddress={0}", ToLuup(macAddress))
                ); // Engine.Luup_CallAction
        }
        #endregion Action LogIpRequest
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "ActiveScenes":
                    _mActiveScenes = FromLuupString(value); return true;
                case "DataFormat":
                    _mDataFormat = FromLuupString(value); return true;
                case "DataVersion":
                    _mDataVersion = FromLuupUInt32(value); return true;
                case "DataVersionStatus":
                    _mDataVersionStatus = FromLuupUInt32(value); return true;
                case "DataVersionUserData":
                    _mDataVersionUserData = FromLuupUInt32(value); return true;
                case "DeviceNum":
                    _mDeviceNum = FromLuupUInt32(value); return true;
                case "Reload":
                    _mReload = FromLuupBoolean(value); return true;
                case "UDN":
                    _mUDN = FromLuupString(value); return true;
                case "UserData":
                    _mUserData = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public HomeAutomationGateway1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

